package com.hs.pre.page;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

public class PageUtil {

	/***
	 * 最后结果
	 */
	public List resultList;
	
	/**
	 * 页面基本信息参数
	 */
	private IPage iPage;
	
	/***
	 * 返回参数
	 */
	private PageParam pageParam;
	
	/**
	 * 分页样式设置
	 */
	private PageStyle pageStyle;
	
	public PageUtil()
	{
		pageParam = new PageParam(null);
	}
	
	public PageUtil(IPage iPage,PageParam pageParam)
	{
		this.iPage = iPage;
		this.pageParam = pageParam;
	}
	
	/**
	 * 获得分页显示html
	 * 
	 * 默认分页类型为DefaultPageStyle
	 * @return
	 */
	public String viewHTML(){
		if(pageStyle == null){
			pageStyle = new DefaultPageStyle();
		}
		pageStyle.setPageStyle(iPage, pageParam);
		return pageStyle.getViewHTML();
	}

	public List getResultList() {
		return resultList;
	}

	public void setResultList(List resultList) {
		this.resultList = resultList;
	}

	public PageStyle getPageStyle() {
		return pageStyle;
	}

	public void setPageStyle(PageStyle pageStyle) {
		this.pageStyle = pageStyle;
	}
	
	public IPage getIPage()
	{
		return this.iPage;
	}

}
